/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * StringDescripteur.java
 *
 * Created on 1 juin 2011, 15:34:26
 */
package cbrtator.Descripteur;

import java.util.ArrayList;
import org.jdesktop.application.Action;
import rapc.descripteur;
import rapc.descripteurString;

/**
 *
 * @author rikoukiki
 */
public class StringDescripteur extends javax.swing.JPanel {
    
    private ArrayList<descripteur> ldescripteur;
    /** Creates new form StringDescripteur */
    
    public StringDescripteur() {
        initComponents();
    }
    
       public StringDescripteur(ArrayList<descripteur> ldescripteur) {
        this.ldescripteur=ldescripteur;
        initComponents();
    }
    
    @Action
    public void ajouteDes(){
        
        descripteurString des = new descripteurString();
        
        //nom
        des.setNom(Tnom.getText());
        //valeur par defaut
        des.setDefault(Tvaldef.getText());
        //valeur normal
        des.setNormal(Tnorm.getText()); 
        //commentaire
        des.setExplication(Tcommentaire.getText());
        
        //id ? 
        des.setCaseId("exemple");
        
        ldescripteur.add(des);
          
               
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Normal = new javax.swing.JLabel();
        Tnorm = new javax.swing.JTextField();
        Vald = new javax.swing.JLabel();
        Tnom = new javax.swing.JTextField();
        Tvaldef = new javax.swing.JTextField();
        nom = new javax.swing.JLabel();
        Commentaire = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        Tcommentaire = new javax.swing.JTextArea();
        Benreg = new javax.swing.JButton();

        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(cbrtator.CbrtatorApp.class).getContext().getResourceMap(StringDescripteur.class);
        Normal.setText(resourceMap.getString("Normal.text")); // NOI18N
        Normal.setName("Normal"); // NOI18N

        Tnorm.setName("Tnorm"); // NOI18N
        Tnorm.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TnormActionPerformed(evt);
            }
        });

        Vald.setText(resourceMap.getString("Vald.text")); // NOI18N
        Vald.setName("Vald"); // NOI18N

        Tnom.setName("Tnom"); // NOI18N
        Tnom.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TnomActionPerformed(evt);
            }
        });

        Tvaldef.setName("Tvaldef"); // NOI18N
        Tvaldef.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TvaldefActionPerformed(evt);
            }
        });

        nom.setText(resourceMap.getString("nom.text")); // NOI18N
        nom.setName("nom"); // NOI18N

        Commentaire.setText(resourceMap.getString("Commentaire.text")); // NOI18N
        Commentaire.setName("Commentaire"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        Tcommentaire.setColumns(20);
        Tcommentaire.setRows(5);
        Tcommentaire.setName("Tcommentaire"); // NOI18N
        jScrollPane1.setViewportView(Tcommentaire);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(cbrtator.CbrtatorApp.class).getContext().getActionMap(StringDescripteur.class, this);
        Benreg.setAction(actionMap.get("ajouteDes")); // NOI18N
        Benreg.setText(resourceMap.getString("Benreg.text")); // NOI18N
        Benreg.setName("Benreg"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(Benreg)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(nom)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE)
                        .addComponent(Tnom, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(Normal)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
                        .addComponent(Tnorm, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(Vald)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(Tvaldef, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(101, 101, 101)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(Commentaire)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 206, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(114, 114, 114))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nom)
                    .addComponent(Tnom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Vald)
                    .addComponent(Tvaldef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Normal)
                    .addComponent(Tnorm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Commentaire)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Benreg)
                .addContainerGap(70, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void TnomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TnomActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_TnomActionPerformed

    private void TnormActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TnormActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_TnormActionPerformed

    private void TvaldefActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TvaldefActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_TvaldefActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Benreg;
    private javax.swing.JLabel Commentaire;
    private javax.swing.JLabel Normal;
    private javax.swing.JTextArea Tcommentaire;
    private javax.swing.JTextField Tnom;
    private javax.swing.JTextField Tnorm;
    private javax.swing.JTextField Tvaldef;
    private javax.swing.JLabel Vald;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel nom;
    // End of variables declaration//GEN-END:variables
}
